public class Demo2 {
    /**
     *
     * @param num 用户输入的数字
     * @return  strOddOrEven  输出的字符串
     */
    public static String getOddOrEven(int num) {
        String strOddOrEven = "";
        if (num % 2 == 0) {
            strOddOrEven = "为偶数";
        } else
            strOddOrEven = "为奇数";
        return strOddOrEven;
    }

    public static void main(String[] args) {

        for (int i=1;i<=10;i++){
            String OddOrEven;
            OddOrEven = getOddOrEven(i);
            System.out.println("数字" + i + OddOrEven);
        }



    }
}
